//
//  UserInfo.m
//  99SVR
//
//  Created by xia zhonglin  on 12/9/15.
//  Copyright © 2015 xia zhonglin . All rights reserved.
//

#import "UserInfo.h"

@implementation UserInfo
DEFINE_SINGLETON_FOR_CLASS(UserInfo)

- (void)updateUserInfo:(UserInfo *)info {
    self.userId = info.userId;
    self.sessionId = info.sessionId;
}

- (void)updateUserSecurityInfo:(NSDictionary *)dic {
    self.bindType = [dic[@"bindType"] integerValue];
    self.level = [dic[@"level"] integerValue];
    
    self.isBindEmail = [dic[@"isBindEmail"] boolValue];
    self.isBindGoogle = [dic[@"isBindGoogle"] boolValue];
    self.isBindTelephone = [dic[@"isBindTelephone"] boolValue];
    self.isLoginPassword = [dic[@"isLoginPassword"] boolValue];
    self.isTradePassword = [dic[@"isTradePassword"] boolValue];
    
    self.device_name = dic[@"device_name"];
    self.email = dic[@"email"];
    self.loginName = dic[@"loginName"];
    self.telNumber = dic[@"telNumber"];
}

- (NSDictionary *)getHeaderDic {
    NSDictionary * dic = [NSDictionary dictionaryWithObjectsAndKeys:self.userId,@"userId",self.sessionId,@"sessionId", nil];
    return dic;
}

+ (BOOL)isLogin {
    return [UserInfo sharedUserInfo].bIsLogin;
}

@end

